package com.guowangwei.gwwexperiment1.config;

import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;

@Configuration
public class MyConfig {

    @Bean
    public CommandLineRunner commandLineRunner(ApplicationContext context) {
        return args -> {
            final String[] beanDefinitionNames = context.getBeanDefinitionNames();
            Arrays.stream(beanDefinitionNames)
                    .sorted()
                    .forEach(System.out::println);
        };
    }
}
